<!-- 参考官方文档 -->
<template>
    <view class="">
        <view class="">
            <button @click="onOpenSetting">打开设置</button>
        </view>
    </view>
</template>

<script lang="ts" setup>
    //打开授权
    function onOpenSetting() {
        //打开授权
        uni.openSetting({
            success: res => {
                if (res.authSetting['scope.writePhotosAlbum']) {
                    uni.showToast({
                        title: "获取授权成功",
                        icon: "none"
                    });
                } else {
                    uni.showToast({
                        title: "获取授权失败",
                        icon: "none"
                    });
                };
            }
        });
    };
</script>

<style lang="scss" scoped>

</style>